import { IsEmail, IsString, Length } from 'class-validator';

export class RegisterDto {
  @IsEmail()
  @Length(4, 20, {
    message: JSON.stringify({ message: '邮箱长度必须是4-20', code: 1000 }),
  })
  readonly email: string;

  @IsString()
  @Length(8, 20, {
    message: JSON.stringify({ message: '密码长度必须为8-20', code: 1001 }),
  })
  readonly password: string;

  @IsString()
  @Length(8, 20, {
    message: JSON.stringify({ message: '确认密码长度必须为8-20', code: 1002 }),
  })
  readonly confirmPassword: string;

  // @IsString()
  // @Length(6, 6, {
  //   message: JSON.stringify({ message: '验证码长度必须为6位数字', code: 1008 }),
  // })
  // readonly verifyCode: string;
}

export class SignInDto {
  @IsEmail()
  @Length(4, 20, {
    message: JSON.stringify({ message: '邮箱长度必须是4-20', code: 1000 }),
  })
  readonly email: string;

  @IsString()
  @Length(8, 20, {
    message: JSON.stringify({ message: '密码长度必须为8-20', code: 1001 }),
  })
  readonly password: string;
}

export class VerifyDto {
  @IsString()
  @Length(6, 6, {
    message: JSON.stringify({ message: '验证码长度必须为6位数字', code: 1008 }),
  })
  readonly code: string;
}
